package com.shuiyun.cloud.controller;

import com.shuiyun.cloud.client.TkClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

@RestController
@Api(tags = "对外暴露接口")
@RequestMapping("api")
public class ApiController {

    @Autowired
    private TkClient tkClient;


    @GetMapping("/test")
    @ApiOperation("测试接口")
    public String test(){
        return "api is ok";
    }

    @GetMapping("/test2")
    @ApiOperation("测试接口")
    public String test2(){
        String test = tkClient.test();
        return test;
    }

    @GetMapping("/error")
    @ApiOperation("报错测试接口")
    public String error(){
        int i = 1/0;
        return "";
    }

    @GetMapping("/error2")
    @ApiOperation("报错测试接口")
    public String error2(){
        try {
            int i = 1/0;
        }catch (Exception e){
            throw new RuntimeException("自定义异常");
        }
        return "";
    }


}
